﻿/*
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Common;


namespace IvyOrm.Test.MockProvider
{
    [System.ComponentModel.DesignerCategory("")]
    public class MockConnection : DbConnection
    {
        protected override DbTransaction BeginDbTransaction(System.Data.IsolationLevel isolationLevel)
        {
            throw new NotImplementedException();
        }
        public override void ChangeDatabase(string databaseName)
        {
            throw new NotImplementedException();
        }
        public override void Close()
        {
            throw new NotImplementedException();
        }

        public override string ConnectionString { get; set; }

        protected override DbCommand CreateDbCommand()
        {
            return new MockCommand { Connection = this };
        }

        public override string DataSource
        {
            get { throw new NotImplementedException(); }
        }

        public override string Database
        {
            get { throw new NotImplementedException(); }
        }

        public override void Open()
        {
            throw new NotImplementedException();
        }

        public override string ServerVersion
        {
            get { throw new NotImplementedException(); }
        }

        public override System.Data.ConnectionState State
        {
            get { throw new NotImplementedException(); }
        }
    }

    [System.ComponentModel.DesignerCategory("")]
    public class MockFactory : DbProviderFactory
    {
        public static MockFactory Instance = new MockFactory();

        public override DbCommandBuilder CreateCommandBuilder()
        {
            return new MockDatabaseBuilder();
        }

        public override DbParameter CreateParameter()
        {
            return new MockParamater();
        }
    }

    [System.ComponentModel.DesignerCategory("")]
    public class MockDatabaseBuilder : DbCommandBuilder
    {

        protected override void ApplyParameterInfo(DbParameter parameter, System.Data.DataRow row, System.Data.StatementType statementType, bool whereClause)
        {
            throw new NotImplementedException();
        }

        protected override string GetParameterName(string parameterName)
        {
            throw new NotImplementedException();
        }

        protected override string GetParameterName(int parameterOrdinal)
        {
            throw new NotImplementedException();
        }

        protected override string GetParameterPlaceholder(int parameterOrdinal)
        {
            return "@p" + parameterOrdinal.ToString();
        }

        protected override void SetRowUpdatingHandler(DbDataAdapter adapter)
        {
            throw new NotImplementedException();
        }

        public override string QuoteIdentifier(string unquotedIdentifier)
        {
            return "[" + unquotedIdentifier + "]";
        }
    }

    [System.ComponentModel.DesignerCategory("")]
    public class MockCommand : DbCommand
    {
        public override void Cancel()
        {

        }

        public override string CommandText { get; set; }

        public override int CommandTimeout { get; set; }

        public override System.Data.CommandType CommandType { get; set; }

        protected override DbParameter CreateDbParameter()
        {
            return new MockParamater();
        }

        protected override DbConnection DbConnection { get; set; }

        DbParameterCollection m_DbParameterCollection = new MockParameterCollection();
        protected override DbParameterCollection DbParameterCollection
        {
            get { return m_DbParameterCollection; }
        }

        protected override DbTransaction DbTransaction { get; set; }

        public override bool DesignTimeVisible { get; set; }

        protected override DbDataReader ExecuteDbDataReader(System.Data.CommandBehavior behavior)
        {
            throw new NotImplementedException();
        }

        public override int ExecuteNonQuery()
        {
            throw new NotImplementedException();
        }

        public override object ExecuteScalar()
        {
            throw new NotImplementedException();
        }

        public override void Prepare()
        {

        }

        public override System.Data.UpdateRowSource UpdatedRowSource { get; set; }
    }

    [System.ComponentModel.DesignerCategory("")]
    public class MockParameterCollection : DbParameterCollection
    {

        public override int Add(object value)
        {
            return 0;
        }

        public override void AddRange(Array values)
        {
            
        }

        public override void Clear()
        {
            throw new NotImplementedException();
        }

        public override bool Contains(string value)
        {
            throw new NotImplementedException();
        }

        public override bool Contains(object value)
        {
            throw new NotImplementedException();
        }

        public override void CopyTo(Array array, int index)
        {
            throw new NotImplementedException();
        }

        public override int Count
        {
            get { throw new NotImplementedException(); }
        }

        public override System.Collections.IEnumerator GetEnumerator()
        {
            throw new NotImplementedException();
        }

        protected override DbParameter GetParameter(string parameterName)
        {
            throw new NotImplementedException();
        }

        protected override DbParameter GetParameter(int index)
        {
            throw new NotImplementedException();
        }

        public override int IndexOf(string parameterName)
        {
            throw new NotImplementedException();
        }

        public override int IndexOf(object value)
        {
            throw new NotImplementedException();
        }

        public override void Insert(int index, object value)
        {
            throw new NotImplementedException();
        }

        public override bool IsFixedSize
        {
            get { throw new NotImplementedException(); }
        }

        public override bool IsReadOnly
        {
            get { throw new NotImplementedException(); }
        }

        public override bool IsSynchronized
        {
            get { throw new NotImplementedException(); }
        }

        public override void Remove(object value)
        {
            throw new NotImplementedException();
        }

        public override void RemoveAt(string parameterName)
        {
            throw new NotImplementedException();
        }

        public override void RemoveAt(int index)
        {
            throw new NotImplementedException();
        }

        protected override void SetParameter(string parameterName, DbParameter value)
        {
            throw new NotImplementedException();
        }

        protected override void SetParameter(int index, DbParameter value)
        {
            throw new NotImplementedException();
        }

        public override object SyncRoot
        {
            get { throw new NotImplementedException(); }
        }
    }

    [System.ComponentModel.DesignerCategory("")]
    public class MockParamater : DbParameter
    {
        public override System.Data.DbType DbType { get; set; }
        public override System.Data.ParameterDirection Direction { get; set; }
        public override bool IsNullable { get; set; }
        public override string ParameterName { get; set; }

        public override void ResetDbType()
        {

        }

        public override int Size { get; set; }
        public override string SourceColumn { get; set; }
        public override bool SourceColumnNullMapping { get; set; }
        public override System.Data.DataRowVersion SourceVersion { get; set; }
        public override object Value { get; set; }
    }
}
